﻿@using LotteryVoteMVC.Models
@using LotteryVoteMVC.Resources
@model IEnumerable<LotteryVoteMVC.Models.LotteryCompany>
@{
    object hasAll, selectedValue;
    if (!ViewData.TryGetValue("HasAll", out hasAll))
    {
        hasAll = true;
    }
    if (!ViewData.TryGetValue("Selected", out selectedValue))
    {
        selectedValue = 0;
    }
}
<select id="Company" name="Company">
    @if ((bool)hasAll)
    {
        <option value="0">@Resource.All</option>
    }
    @foreach (LotteryCompany company in Model)
    { 
        <option @(company.CompanyId == (int)selectedValue ? "selected" : "") value="@company.CompanyId">@company.Name</option>
    }
</select>